package viroyal.com.base.net;

import com.suntiago.network.network.rsp.BaseResponse;

import java.util.List;

import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Completable;
import rx.Observable;
import viroyal.com.base.face.rsp.DeviceInfoRsp;
import viroyal.com.base.face.rsp.FeaturesSyncRsp;
import viroyal.com.base.model.FeaturesUploadBean;
import viroyal.com.base.net.entity.IOTMessage;
import viroyal.com.base.net.req.DeviceRegisterRequest;
import viroyal.com.base.net.req.DistributeSchoolRequest;
import viroyal.com.base.net.req.FaceRequest;
import viroyal.com.base.net.req.GetSchoolIdRequest;
import viroyal.com.base.net.req.IOTConfigRequest;
import viroyal.com.base.net.req.RegisterIOTRequest;
import viroyal.com.base.net.req.SwipeRequest;
import viroyal.com.base.net.req.TakePhotoRequest;
import viroyal.com.base.net.req.TokenRequest;
import viroyal.com.base.net.req.UpDateAppInfoRequest;
import viroyal.com.base.net.rsp.AnnouncedResponseS;
import viroyal.com.base.net.rsp.AppInfoRspS;
import viroyal.com.base.net.rsp.BroadcastResponseS;
import viroyal.com.base.net.rsp.CountDownTimeInfoResponse;
import viroyal.com.base.net.rsp.DeviceRegisterResponseS;
import viroyal.com.base.net.rsp.DistributeSchoolResponseS;
import viroyal.com.base.net.rsp.ExamResponse;
import viroyal.com.base.net.rsp.FaceUrlResponseS;
import viroyal.com.base.net.rsp.FoodResponseS;
import viroyal.com.base.net.rsp.GetDeviceInfoResponseS;
import viroyal.com.base.net.rsp.GetRedFlagResponse;
import viroyal.com.base.net.rsp.GetSchoolIdResponseS;
import viroyal.com.base.net.rsp.GetSchoolListResponseS;
import viroyal.com.base.net.rsp.GetTaskListResponse;
import viroyal.com.base.net.rsp.HomeInfoResponseS;
import viroyal.com.base.net.rsp.IOTConfigResponseS;
import viroyal.com.base.net.rsp.MottoResponseS;
import viroyal.com.base.net.rsp.NoticeResponse;
import viroyal.com.base.net.rsp.ParentLinkStudentsResponseS;
import viroyal.com.base.net.rsp.QrCodeResponseS;
import viroyal.com.base.net.rsp.RegisterIOTResponseS;
import viroyal.com.base.net.rsp.SerialNumberS;
import viroyal.com.base.net.rsp.StudentSignRecordResponseS;
import viroyal.com.base.net.rsp.StudentsResponseS;
import viroyal.com.base.net.rsp.StyleResponseS;
import viroyal.com.base.net.rsp.SwipeAllFaceResponseS;
import viroyal.com.base.net.rsp.SwipeResponseS;
import viroyal.com.base.net.rsp.TimetablesResponse;
import viroyal.com.base.net.rsp.TokenResponseS;
import viroyal.com.base.net.rsp.UpDateAppInfoResponseS;
import viroyal.com.base.net.rsp.VersionResponse;
import viroyal.com.base.net.rsp.WeatherResponseS;


/**
 * @author chenjunwei
 * @desc
 * @date 2019/7/4
 */
public interface ApiObserver {
    /**
     * 获取特征值列表
     *
     * @param imei
     * @param school_id
     * @param
     * @return
     */
    @GET("app/face/v1/eigenvalue-list")
    Observable<FeaturesSyncRsp> getFeatureList(@Header("imei") String imei,
                                               @Header("school_id") String school_id,
                                               @Query("update_time") String update_time,
                                               @Query("next_id") String next_id);

    /**
     * 获取设备硬件信息
     *
     * @param unit_id
     * @param imei
     * @return
     */
    @GET("device/common/v1/device-info")
    Observable<DeviceInfoRsp> getDeviceInfo(@Header("unit_id") String unit_id,
                                            @Header("imei") String imei);

    /**
     * 刷卡签到
     *
     * @param school_id
     * @param param
     * @return
     */
    @POST("app/card/v1/class-brand-sign")
    Observable<SwipeResponseS> swipeSign(@Header("school_id") String school_id,
                                         @Body SwipeRequest param);

    /**
     * 批量刷脸签到(一个家长绑定多个学生)
     *
     * @param school_id
     * @param param
     * @return
     */
    @POST("app/face/v1/feature/studentsignlist")
    Observable<SwipeAllFaceResponseS> allFaceSign(@Header("school_id") String school_id,
                                                  @Body List<SwipeRequest> param);

    /**
     * 单个刷脸签到
     *
     * @param school_id
     * @param param
     * @return
     */
    @POST("app/face/v1/class-brand-sign")
    Observable<SwipeResponseS> faceSign(@Header("school_id") String school_id,
                                        @Body FaceRequest param);

    /**
     * 菜谱
     *
     * @param school_id
     * @return
     */
    @GET("device/v1/dishes")
    Observable<FoodResponseS> foods(@Header("school_id") String school_id);

    /**
     * 界面风格
     *
     * @param school_id
     * @param code
     * @return
     */
    @GET("device/common/v1/device-style")
    Observable<StyleResponseS> style(@Header("unit_id") String school_id,
                                     @Header("imei") String imei,
                                     @Query("code") String code);

    /**
     * 通知通告
     *
     * @param mac
     * @return
     */
    @GET("device/v1/notice-device")
    Observable<AnnouncedResponseS> announced(@Header("unit_id") String mac,
                                             @Header("imei") String imei);

    /**
     * 轮播图
     *
     * @param school_id
     * @param imei
     * @param type
     * @return
     */
    @GET("device/v1/slideshow-info")
    Observable<BroadcastResponseS> broadcast(@Header("school_id") String school_id,
                                             @Header("imei") String imei,
                                             @Query("type") int type);

    /**
     * 3天天气
     */
    @GET("device/app/weather")
    Observable<WeatherResponseS> get3DaysWeather(@Header("master_key") String master_key,
                                                 @Query("area") String area);


    /**
     * 首页接口
     *
     * @param school_id
     * @param imei
     * @return
     */
    @GET("device/v1/home-info")
    Observable<HomeInfoResponseS> homeinfo(@Header("school_id") String school_id,
                                           @Header("imei") String imei);

    /**
     * 学生列表
     *
     * @param imei
     * @param school_id
     * @return
     */
    @GET("app/face/v1/attendance-list")
    Observable<StudentsResponseS> students(@Header("imei") String imei,
                                           @Header("school_id") String school_id,
                                           @Query("update_time") String update_time);

    /**
     * 学生签到记录
     *
     * @param dev_mac
     * @param school_id
     * @return
     */
    @GET("app/face/v1/attendancelog")
    Observable<StudentSignRecordResponseS> getStudentSignRecord(@Header("imei") String dev_mac,
                                                                @Header("school_id") String school_id);

    /**
     * 获取二维码url
     *
     * @param unit_id
     * @return
     */
    @GET("app/qrcode/v1/scan-config")
    Observable<QrCodeResponseS> getQrCodeUrl(@Header("unit_id") String unit_id,
                                             @Query("key") String key);

    /**
     * 上传异常拍照
     *
     * @param schoolId
     * @param param
     * @return
     */
    @POST("app/face/v1/uploadphoto")
    Observable<BaseResponse> uploadFailPhoto(@Header("school_id") String schoolId,
                                             @Body TakePhotoRequest param);

    /**
     * 获取刷脸相关信息
     *
     * @param union_id
     * @param swipe_time
     * @return
     */
    @GET("app/face/v1/information")
    Observable<ParentLinkStudentsResponseS> getParentLinkStudent(@Header("school_id") String school_id,
                                                                 @Query("union_id") String union_id,
                                                                 @Query("swipe_time") String swipe_time);

    /**
     * 版本升级
     */
    @GET("api/app/getApk")
    Observable<VersionResponse> getVersion();


    /**
     * 设备自注册
     *
     * @return
     */
    @POST("api/register")
    Observable<DeviceRegisterResponseS> deviceRegister(@Body DeviceRegisterRequest registerRequest);

    /**
     * 获取学校列表
     *
     * @return
     */
    @GET("api/getUnits")
    Observable<GetSchoolListResponseS> getSchoolList();

    /**
     * 设备分配学校
     *
     * @return
     */
    @POST("api/assignDevice")
    Observable<DistributeSchoolResponseS> distributeSchool(@Body DistributeSchoolRequest request);

    /**
     * 获取学校id
     *
     * @return
     */
    @POST("api/getUnitId")
    Observable<GetSchoolIdResponseS> getSchoolId(@Body GetSchoolIdRequest request);


    /**
     * 获取设备信息
     *
     * @return
     */
    @POST("api/getDeviceName")
    Observable<GetDeviceInfoResponseS> getDeviceInfo(@Body GetSchoolIdRequest request);

    /**
     * 版本升级
     *
     * @return
     */
    @POST("api/getDeviceApply")
    Observable<UpDateAppInfoResponseS> getUpDataAppInfo(@Body UpDateAppInfoRequest request);

    /**
     * 获取图片列表 注册特征值
     *
     * @param school_id
     * @param dev_mac
     * @param type
     * @return
     */
    @GET("api/facecollect/task/face")
    Observable<FaceUrlResponseS> getFaceUrl(@Header("school_id") String school_id,
                                            @Header("master_key") String master_key,
                                            @Query("dev_mac") String dev_mac,
                                            @Query("type") String type);


    /**
     * 上传特征值
     *
     * @param featuresUploadBeans
     * @param schoolId
     * @return
     */
    @POST("api/facecollect/task/uploadVal")
    Observable<BaseResponse> uploadFeatures(@Body List<FeaturesUploadBean> featuresUploadBeans,
                                            @Header("school_id") String schoolId, @Header("master_key") String master_key);


    /**
     * 获取微服务
     *
     * @param schoolId
     * @param imei
     * @param type
     * @return
     */
    @GET("device/v1/app-info")
    Observable<AppInfoRspS> getAppInfo(@Header("school_id") String schoolId,
                                       @Header("imei") String imei,
                                       @Query("type") String type);


    /**
     * 获取百度离线序列号
     *
     * @param schoolId
     * @param imei
     * @return
     */
    @GET("device/v1/api-config")
    Observable<SerialNumberS> getSerialNumber(@Header("unit_id") String schoolId,
                                              @Header("imei") String imei);

    /**
     * 考试模式
     *
     * @param imei
     * @param unit_id
     * @return
     */
    @GET("device/v1/exam-info")
    Observable<ExamResponse> exam(@Header("imei") String imei,
                                  @Header("unit_id") String unit_id);


    /**
     * 课表
     *
     * @param imei
     * @param unit_id
     * @return
     */
    @GET("device/v1/timetables-class")
    Observable<TimetablesResponse> timetables(@Header("imei") String imei,
                                              @Header("unit_id") String unit_id);


    /**
     * 倒计时
     *
     * @param imei
     * @param unit_id
     * @return
     */
    @GET("device/v1/count-down")
    Observable<CountDownTimeInfoResponse> getCountTime(@Header("imei") String imei,
                                                       @Header("unit_id") String unit_id);

    /**
     * 获取任务列表
     *
     * @param imei
     * @param unit_id
     * @return
     */
    @GET("app/face/v1/sign-task-list")
    Observable<GetTaskListResponse> getTaskList(@Header("imei") String imei,
                                                @Header("school_id") String unit_id);


    /**
     * 是否有小红旗
     *
     * @param
     * @param
     * @return
     */
    @GET("app/inspect/show/redflag")
    Observable<GetRedFlagResponse> getRedFlag(@Header("dev_mac") String dev_mac);

    /**
     * 获取校训
     * @param schoolId
     * @param master_key
     * @return
     */
    @GET("api/home/school-motto-banner")
    Observable<MottoResponseS> Motto(@Header("master_key") String master_key, @Query("unit_id") String schoolId);

    /**
     * 获取物联网token
     */
    @POST("api/auth/login")
    Observable<TokenResponseS> getToken(@Body TokenRequest tokenRequest);

    /**
     * 物联网注册
     * @param token
     * @param registerIOTRequest
     * @return
     */
    @POST("api/viot_register")
    Observable<RegisterIOTResponseS> register_iot(@Header("Authorization") String token,@Body RegisterIOTRequest registerIOTRequest);

    /**
     * 获取物联网配置
     * @param token
     * @param registerIOTRequest
     * @return
     */
    @POST("api/viot_config")
    Observable<IOTConfigResponseS> config_iot(@Header("Authorization") String token, @Body IOTConfigRequest iotConfigRequest);

    /**
     * 获取物联网通知公告
     * @param unit_id
     * @param iotMessage
     * @return
     */
    @POST("api/viot_message")
    Observable<NoticeResponse> getNoice(@Header("Authorization") String token,@Header("unit-id") String unit_id, @Body IOTMessage iotMessage);
}
